package com.ponhu.ea2.service.facade;

import com.ponhu.ea2.common.basic.model.PagedResult;
import com.ponhu.ea2.dto.*;
import com.ponhu.ea2.entity.Goods;
import com.ponhu.ea2.entity.Inventory;
import com.ponhu.ea2.enums.ThirdSystemEnum;
import com.ponhu.ea2.query.InventoryDownloadTaskQuery;
import com.ponhu.ea2.query.InventoryInfoQuery;
import com.ponhu.ea2.query.LiveGoodsInfoQuery;
import com.ponhu.ea2.vo.*;

import java.util.List;
import java.util.concurrent.CompletableFuture;

public interface InventoryApiService {

    /**
     * 条件查询全部货品列表
     *
     * @return
     */
    PagedResult<PhInventoryListVo> getAllInventorysByQuery(InventoryInfoQuery inventoryInfoQuery);

    /**
     * 根据货品编码获取中检溯源码信息
     *
     * @param inventoryCode
     * @return
     */
    PhInventoryAppraisalVo getSourceCodeByCode(String inventoryCode);

    /**
     * 同步货品中检结果
     *
     * @param phInventoryAppraisalDto
     * @return
     */
    Boolean syncInventoryAppraisal(PhInventoryAppraisalDto phInventoryAppraisalDto);

    /**
     * 根据货品ID查询货品详情
     *
     * @param inventoryId
     * @return
     */
    PhInventoryDetailVo getInventoryDetailById(Long inventoryId, Integer type);

    /**
     * 根据货品ID和物料ID设置货品关联物料
     *
     * @return
     */
    Boolean setInventoryMaterial(InventoryMaterialSetDto inventoryMaterialSetDto);

    /**
     * 编辑货品相关信息(附件、配件、属性)
     *
     * @return
     */
    Boolean editPhInventory(PhInventoryDetailEditDto phInventoryDetailEditDto);

    /**
     * 编辑货品相关商品信息
     *
     * @return
     */
    Boolean editInventoryGoods(PhInventoryGoodsEditDto phInventoryDetailEditDto);

    void editInventoryGoodsTransactional(PhInventoryGoodsEditDto editDto);

    /**
     * 保存商品和货品信息
     *
     * @param inventory
     * @param goods
     * @return
     */
    Boolean saveInventoryAndGoods(Inventory inventory, Goods goods);

    /**
     * 根据入库方式生成货品编码
     *
     * @param type
     * @return
     */
    List<String> getInventoryCodeByType(String type, Integer size, ThirdSystemEnum systemEnum, Integer isSecondhand);

    /**
     * 根据入库方式生成货品编码
     *
     * @param type
     * @return
     */
    List<String> getInventoryCodeByType(String type, Integer size, ThirdSystemEnum systemEnum);

    /**
     * 判断货品编码是否已经使用并入库：true-已使用，false-未使用
     *
     * @param inventoryCode
     * @return
     */
    Boolean checkInventoryCodeIsUsed(String inventoryCode);

    /**
     * 更新商品和货品信息
     *
     * @param inventory
     * @param goods
     * @return
     */
    boolean updateInventoryAndGoods(Inventory inventory, Goods goods);

    /**
     * 获取所有第一次编辑人的信息
     *
     * @return
     */
    List<PhInventoryEditorVo> getPhInventoryEditName();

    /**
     * 获取条形码
     *
     * @param inventoryCode 货品编码
     * @return 条形码图片地址
     */
    String getBarCode(String inventoryCode);

    /**
     * Erp养护增加货品相关成本
     *
     * @param inventoryMaintainCostDto
     * @return
     */
    Boolean inventoryMaintainCost(InventoryMaintainCostDto inventoryMaintainCostDto);

    /**
     * 编辑货品信息后同步胖总管
     *
     * @param inventoryId
     */
    boolean syncThirdParties(Long inventoryId, String editName);

    boolean syncThirdParties(Long inventoryId, String editName, CompletableFuture<String> audioFuture);

    /**
     * 分页查询商品信息,直播使用
     *
     * @param liveGoodsInfoQuery
     * @return
     */
    PagedResult<PhGoodsInfoForLiveVo> queryPhGoodsInfoForLiveVo(LiveGoodsInfoQuery liveGoodsInfoQuery);

    /**
     * 获取货品条形码信息
     *
     * @return
     */
    InventorBarCodeInfoVo getInventorBarCodeInfo(String inventoryCode);

    List<String> aiPictureInventoryBatchSync(List<String> inventoryCodeList);

    Boolean aiPictureInventoryBatchAsync(List<String> inventoryCodeList);

    /**
     * 查询所有的商品信息,导出Excel
     *
     * @return
     */
    String getAllInventorys();

    InventoryBatchEditResVo batchEditPriceUpload(List<InventoryBatchEditPriceVo> editPriceVoList, OperatorDto operatorDto);

    InventoryBatchEditResVo batchEditRemarksUpload(List<InventoryBatchEditRemarksVo> editRemarksVoList, int type, OperatorDto operatorDto);

    PhInventoryDetailVo getInventoryDetailByCode(String inventoryCode);

    Integer getInventoryStockByCode(Long inventoryId);

    List<InventoryDownLoadFailVo> createDownloadTask(List<String> inventoryCodeList, OperatorDto operatorDto);

    PagedResult<InventoryDownLoadListVo> getDownloadTaskList(InventoryDownloadTaskQuery taskQuery);

    List<PhInventoryToAmqpVo> queryGoodsinfoForApplet(List<String> inventoryCodes);

    Boolean inventoryMaintainResult(InventoryMaintainResultDto inventoryMaintainResultDto);
}
